<?php
header('Content-type: application/xls');
header("Content-Disposition:attachment;filename=luyketuan.xls");?>
<div class="zluykes">
<?php echo ('Chỉ tiêu sản xuất kinh doanh lũy kế (Tháng)');?>
<?php 
            echo '<h3>'.$kh['Donvi']['tendv'].'<br></h3>';
           
            echo $kh['Thoigian']['tentg'];
            echo ' Từ:'.date('d/m/Y',strtotime($kh['Thoigian']['ngaybd'])).' đến '.date('d/m/Y',strtotime($kh['Thoigian']['ngaykt'])).'. ';
    ?>

<?php
  echo 'Gồm '.count($zluykes).' sản phẩm';

?>
<table cellpadding="0" cellspacing="0" id="tables" border="1">
<tr>
	
	<th><?php echo ('Tên hàng');?></th>
	
	<th><?php echo ('Lũy kế');?></th>
	<th><?php echo ('Kế hoạch');?></th>
    <th><?php echo ('% hoàn thành');?></th>
	
	</tr>
<?php
$i = 0;
foreach ($zluykes as $zluyke):
	$class = null;
	if ($i++ % 2 == 0) {
		$class = ' class="altrow"';
	}
?>
	<tr<?php echo $class;?>>
		
		<td>
			<?php echo $zluyke['Zluyke']['tenhh']; ?>
		</td>
	
		<td>
        	<?php
                $soban=0; 
                if(!empty($zluyke['Zluyke']['kqban_n']))
                    $soban=$zluyke['Zluyke']['kqban_n'];
                echo $soban; 
                ?>
			</td>
		<td>
		<?php echo $zluyke['Zluyke']['chitieu_n']; ?>
		
		</td>
        <td>
		<?php 
            if($zluyke['Zluyke']['chitieu_n']==0)
                echo 0;
            else 
                echo ($soban/$zluyke['Zluyke']['chitieu_n']*100).'%'; ?>
		
		</td>
		</tr>
<?php endforeach; ?>
</table>
</div>
